package example1;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

public class ByteArrayConverter {
    public static List<String> bytesToBase36List(byte[] bytes) {
        List<String> base36List = new ArrayList<>();

        BigInteger bigInteger = new BigInteger(1, bytes);
        String base36String = bigInteger.toString(36);

        for (char c : base36String.toCharArray()) {
            base36List.add(Character.toString(c));
        }

        return base36List;
    }

    public static String[] bytesToBase36Array(byte[] bytes) {
        List<String> base36List = bytesToBase36List(bytes);
        return base36List.toArray(new String[0]);
    }

    public static void main(String[] args) {
        byte[] bytes = {0x12, 0x34, 0x56, 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0xF0};

        List<String> base36List = bytesToBase36List(bytes);
        System.out.println("36进制字符列表: " + base36List);

        String[] base36Array = bytesToBase36Array(bytes);
        System.out.println("36进制字符数组: " + String.join(" ", base36Array));
    }
}
